<script type="text/javascript" src="http://res.wx.qq.com/open/js/jweixin-1.0.0.js"></script>
<script>
	wx.config({
		debug: false,
		appId: '{$js_sign['appId']}',
		timestamp: {$js_sign['timestamp']},
		nonceStr: '{$js_sign['nonceStr']}',
		signature: '{$js_sign['signature']}',
		jsApiList: [
			// 所有要调用的 API 都要加到这个列表中
			'checkJsApi',
			'onMenuShareTimeline',
			'onMenuShareAppMessage',
			'onMenuShareQQ',
			'onMenuShareWeibo',
			'openProductSpecificView',
			'addCard',
			'chooseCard',
			'openCard'
		]
	});
	wx.ready(function () {
		// 在这里调用 API
		//朋友圈
		wx.onMenuShareTimeline({
			title: '{$sharedata.title}:'+'{$sharedata.desc}',
			desc: '{$sharedata.desc}',
			link: '{$sharedata.link}',
			imgUrl: '{$sharedata.imgUrl}',
			trigger: function (res) {
				//  alert('用户点击并朋友圈');
			},
			success: function () {
				// 用户确认分享后执行的回调函数
				// alert('Timeline分享成功');
			},
			cancel: function () {
				// 用户取消分享后执行的回调函数
				// alert('您取消了分享Timeline');
			}
		});
		wx.onMenuShareAppMessage({
			title: '{$sharedata.title}',
			desc: '{$sharedata.desc}',
			link: '{$sharedata.link}',
			imgUrl: '{$sharedata.imgUrl}',
			type: '', // 分享类型,music、video或link，不填默认为link
			dataUrl: '', // 如果type是music或video，则要提供数据链接，默认为空
			success: function () {
				//  alert('分享给朋友分享成功');
			},
			cancel: function () {
				//  alert('您取消了分享给朋友');
			}
		});

	});
	wx.error(function (res) {
		// alert(res.errMsg);
	});

	$('.a_link').on("tap",function(){
		var link = $(this).attr('attr-url');
		//alert(link)
		window.location.href = link;
	});

</script>